package com.example.proxy1;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

public class JdkProxyFactory {
    public static Object createProxy(Object target, InvocationHandler proxy) {
        ClassLoader loader = proxy.getClass().getClassLoader();
        Class[] interfaces = target.getClass().getInterfaces();
        return Proxy.newProxyInstance(loader, interfaces, proxy);
    }
}
